<template>
  <div class="pagination-container">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="pageSizes"
      :page-size="pageSize"
      :layout="layout"
      :total="total"
      v-bind="$attrs"
    />
  </div>
</template>
  <script>
export default {
  name: "Pagination",
  props: {
    //当前所处页数
    currentPage: {
      type: Number,
      default: 1,
    },
    //页码选项
    pageSizes: {
      type: Array,
      default: () => [10, 20, 30, 40],
    },
    //每页显示的条数
    pageSize: {
      type: Number,
      default: 10,
    },
    //布局配置
    layout: {
      type: String,
      default: "total, sizes, prev, pager, next, jumper",
    },
    //总共条数
    total: {
      type: Number,
      default: 0,
    },
  },
  methods: {
    handleSizeChange(val) {
      this.$emit("size-change", val);
    },
    handleCurrentChange(val) {
      this.$emit("current-change", val);
    },
  },
};
</script>
  
  <style lang="scss" scoped>
.pagination-container {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}
</style>